<template>
  <ie-page>

    <template #extra>
      <n-space>
        <n-button type="primary" @click="$router.push({ name: 'TicketCreate' })">新建事件</n-button>
      </n-space>
    </template>

    <ie-table-query :model="TicketModel" />

    <ie-table
      :model="TicketModel"
      :actions="['view']"
      @view:row="handleView"
      ref="tableRef"
    />
  </ie-page>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

import TicketModel from '/@/model/ticket'

const router = useRouter()
const tableRef = ref()

function handleView(row) {
  router.push({
    name: 'TicketId',
    params: {
      id: row.id
    }
  })
}
</script>